/*
 *  Copyright 2007 Blandware (http://www.blandware.com)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.blandware.atleap.model.core;

/**
 * <p>Represents a tiles definition that may be put into
 * {@link com.blandware.atleap.model.core.TileContainer} as element.</p>
 * <p><a href="TileListComponent.java.html"><i>View source</i></a></p>
 *
 * @author Roman Puchkovskiy <a href="mailto:roman.puchkovskiy@blandware.com">
 *         &lt;roman.puchkovskiy@blandware.com&gt;</a>
 * @version $Revision: 1.2 $ $Date: 2007/04/27 11:42:51 $
 * @see com.blandware.atleap.model.core.TileContainer
 */
public class TileListComponent extends BaseObject {
    /**
     * Container to which this component belongs
     */
    protected TileContainer tileContainer;
    /**
     * Definition name
     */
    protected String name;

    /**
     * Default constructor.
     */
    public TileListComponent() {
    }

    /**
     * Constructor that initializes name.
     *
     * @param name name to set
     */
    public TileListComponent(String name) {
        this.name = name;
    }

    /**
     * Returns container.
     *
     * @return container
     * @hibernate.parent name="tileContainer"
     */
    public TileContainer getTileContainer() {
        return tileContainer;
    }

    /**
     * Sets container.
     *
     * @param tileContainer container to set
     */
    public void setTileContainer(TileContainer tileContainer) {
        this.tileContainer = tileContainer;
    }

    /**
     * Returns component name.
     *
     * @return name
	 * @hibernate.property
	 * @hibernate.column name="`name`" not-null="true" unique="false"
     * length="252"
     */
    public String getName() {
        return name;
    }

    /**
     * Sets component name.
     *
     * @param name name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        TileListComponent that = (TileListComponent) o;

        if (tileContainer != null ? !tileContainer.equals(that.tileContainer)
                : that.tileContainer != null) {
            return false;
        }
        if (name != null ? !name.equals(that.name) : that.name != null) {
            return false;
        }

        return true;
    }

    public int hashCode() {
        int result;
        result = (name != null ? name.hashCode() : 0);
        result = 31 * result + (tileContainer != null ? tileContainer.hashCode() : 0);
        return result;
    }
}
